document.writeln("<div class=\'sidebar sidebar-hide-to-small sidebar-shrink sidebar-gestures\'>");
document.writeln("    <div class=\'nano\'>");
document.writeln("        <div class=\'nano-content\'>");
document.writeln("            <div class=\'logo\'><a href=\'index.html\'>");
document.writeln("                    <!-- <img src=\'assets/images/logo.png\' alt=\'\' /> --><span>个体户商品管理系统</span>");
document.writeln("                </a></div>");
document.writeln("            <ul>");
document.writeln("                <li class=\'label\'>主菜单</li>");
document.writeln("                <li><a class=\'sidebar-sub-toggle\'><i class=\'ti-home\'></i> 主菜单 <span class=\'badge badge-primary\'>2</span>");
document.writeln("                        <span class=\'sidebar-collapse-icon ti-angle-down\'></span></a>");
document.writeln("                    <ul>");
document.writeln("                        <li><a href=\'./index.html\'>状态一览</a></li>");
document.writeln("                        <li><a href=\'./sellingPriceDetails.html\'>商品价格设置</a></li>");
document.writeln("                        <li><a href=\'./sellingAmountDetails.html\'>商品货架保有量设置</a></li>");
document.writeln("                        <li><a href=\'./warehouseManage.html\'>仓库管理</a></li>");
document.writeln("                        <li><a href=\'./shopManage.html\'>商店管理</a></li>");
document.writeln("                    </ul>");
document.writeln("                </li>");
document.writeln("");
document.writeln("                <li class=\'label\'><i class=\'ti-calendar\'></i>系统功能</li>");
document.writeln("                <li><a href=\'./stock.html\'><i class=\'ti-calendar\'></i>进货</a></li>");
document.writeln("                <li><a href=\'./sale.html\'><i class=\'ti-calendar\'></i>售货</a></li>");
document.writeln("                <li><a href=\'./wareCheck.html\'><i class=\'ti-calendar\'></i>理货</a></li>");
document.writeln("            </ul>");
document.writeln("        </div>");
document.writeln("    </div>");
document.writeln("</div>");
document.writeln("<!-- /# sidebar -->");
document.writeln("");
document.writeln("<div class=\'header\'>");
document.writeln("    <div class=\'container-fluid\'>");
document.writeln("        <div class=\'row\'>");
document.writeln("            <div class=\'col-lg-12\'>");
document.writeln("                <div class=\'float-left\'>");
document.writeln("                    <div class=\'hamburger sidebar-toggle\'>");
document.writeln("                        <span class=\'line\'></span>");
document.writeln("                        <span class=\'line\'></span>");
document.writeln("                        <span class=\'line\'></span>");
document.writeln("                    </div>");
document.writeln("                </div>");
document.writeln("                <div class=\'float-right\'>");
document.writeln("                    <div class=\'dropdown dib\'>");
document.writeln("                        <div class=\'header-icon\' data-toggle=\'dropdown\'>");
document.writeln("                            <span class=\'user-avatar\' >欢迎您使用本系统");
document.writeln("                            </span>");
document.writeln("                            <span class=\'user-avatar\' id=\'roleName\' >roleName");
document.writeln("                            </span>");
document.writeln("                            <span class=\'user-avatar\' id=\'userName\' >userName");
document.writeln("                            </span>");
document.writeln("                            <button id=\"logout\" class=\"btn btn-danger btn-outline btn-rounded \">退出登录</button>");
document.writeln("                        </div>");
document.writeln("                    </div>");
document.writeln("                </div>");
document.writeln("            </div>");
document.writeln("        </div>");
document.writeln("    </div>");
document.writeln("</div>");

var nowUserInfo = null;

var requestObj = {};
requestObj["requestService"] = "getNowUserInfo";
requestObj["requestMethod"] = "";
var data = {};
requestObj["data"] = data;
var requestJson = JSON.stringify(requestObj)
$.ajax({
    type: "POST",
    url: "http://192.168.70.135:80/identify/",
    contentType: "application/json",
    data: requestJson,
    async: false,
    success: function (msg) {
        nowUserInfo = msg.data;
        $("#roleName").text(nowUserInfo.roleName);
        $("#userName").text(nowUserInfo.userName);
    },
    error: function (msg) {
        alert("访问页面时发生错误: " + msg.responseJSON.data[0].errorMessage);
        window.location.href = "login.html"
    }
});

$(document).ready(function () {
    $("#logout").click(function () {
        var requestObj = {};
        requestObj["requestService"] = "logout";
        requestObj["requestMethod"] = "";
        var data = {};
        requestObj["data"] = data;
        var requestJson = JSON.stringify(requestObj)
        $.ajax({
            type: "POST",
            url: "http://192.168.70.135:80/identify/",
            contentType: "application/json",
            data: requestJson,
            async: false,
            success: function (msg) {
                window.location.href = "login.html"
            }
        });
    })
})